<template>
  <div class="bigdata-header">
    <div class="weather">
      <img src="../../../assets/weather.png" />
      <div class="weather-num">
        <span>{{tem}}</span>
        <span>
          <span>{{weather}}</span>
          <span>°C</span>
        </span>
      </div>
      <div class="weather-text">
        <span>天气：{{weather}}°C</span>
        <span>温度：{{lowhigh}}</span>
        <span>风况：{{wind}}</span>
      </div>
    </div>
    <div class="header-date">
      <span>{{ currentTime }}</span>
    </div>
    <div class="tab-text" style="margin-right: 30px;" @click="toMonitor">施工监控量测</div>
    <div class="tab-text" @click="toPrediction">超前地质预报</div>
    <img src="../../../assets/3.png" />
    <div class="title">
      <img src="../../../assets/1.png" />
      <img src="../../../assets/2.png" />
      <span>隧道结构监测信息智能管控平台</span>
    </div>
    <div class="tab-text" style="margin-right: 50px;" @click="toQuailty">施工质量检测</div>
    <div class="tab-text" @click="build">隧道设计信息</div>
  </div>
</template>

<script>
import api from "../../../api";
export default {
  name: "",
  components: {},
  data() {
    return {
      zoom: "100%",
      currentTime: "",
      airQuality: "",
      lowhigh: "",
      weather: "",
      wind: "",
      tem:""
    };
  },
  methods: {
    toMonitor() {
      this.$router.push("/monitor/monitorInfo");
    },
    toPrediction() {
      this.$router.push("/geology/predictionInfo");
    },
    toQuailty() {
      this.$router.push("/construction/quailtyAdmin");
    },
    build() {
      this.$router.push("/design/build");
    },
  },
  mounted() {
    api
      .bigdatawather({id:4})
      .then((res) => {
        if(res.data.code == 2001){
          this.airQuality = res.data.data.airQuality
          this.lowhigh = res.data.data.lowhigh
          this.weather = res.data.data.weather
          this.wind = res.data.data.wind
          this.tem = res.data.data.tem
        }
      })
      .catch((err) => {console.log(err)});

    setInterval(() => {
      var time = new Date();
      var y = time.getFullYear();
      var mh = time.getMonth() + 1;
      var d = time.getDate();
      var nday = time.getDay();
      var h = time.getHours();
      h = h < 10 ? "0" + h : h;
      var m = time.getMinutes();
      m = m < 10 ? "0" + m : m;
      var s = time.getSeconds();
      s = s < 10 ? "0" + s : s;
      this.currentTime =
        y + "年" + mh + "月" + d + "日" + " " + h + ":" + m + ":" + s;
    }, 1000);
  },
};
</script>

<style lang="scss" scoped>
.bigdata-header {
  width: 100%;
  min-width: 1800px;
  height: 80px;
  position: absolute;
  left: 0;
  top: 0;
  background-color: #0e1d2c;
  display: flex;
  align-items: center;
  justify-content: center;
  background: url(../../../assets/header-bg.png);
  padding: 0 280px;
  box-sizing: border-box;
  justify-content: space-around;

  > .header-date {
    width: 280px;
    height: 100%;
    position: absolute;
    right: 0;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;

    > span {
      color: #00f6ff;
      font-size: 18px;
    }
  }

  > .weather {
    width: 280px;
    height: 100%;
    box-sizing: border-box;
    position: absolute;
    left: 0;
    top: 0;
    padding-left: 30px;
    display: flex;
    align-items: center;

    > img {
      width: 59px;
      height: 47px;
    }

    > .weather-num {
      width: 60px;
      height: 100%;
      display: flex;
      align-items: center;
      box-sizing: border-box;
      margin-left: 15px;

      > span:nth-child(1) {
        color: #fff;
        font-size: 50px;
        font-weight: 700;
        text-shadow: 0px 0px 15px #009caf;
      }

      > span:nth-child(2) {
        width: 30px;
        margin-top: 6px;
        display: flex;
        flex-direction: column;
        color: #fff;
        font-size: 14px;
        text-shadow: 0px 0px 15px #009caf;
      }
    }

    > .weather-text {
      flex: 1;
      height: 100%;
      display: flex;
      flex-direction: column;
      justify-content: center;
      color: #fff;
      font-size: 12px;

      > span {
        text-shadow: 0px 0px 5px #fff;
      }
    }
  }

  > img {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
  }

  .title {
    width: 600px;
    height: 100%;
    position: relative;
    z-index: 9;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-left: 30px;
    margin-right: 30px;

    > img {
      width: 100%;
      height: 100%;
      position: absolute;
      left: 0;
      top: 0;
    }

    > img:nth-child(1) {
      z-index: 2;
    }

    > img:nth-child(2) {
      z-index: 1;
    }

    > span {
      color: #fff;
      font-size: 28px;
      font-weight: 700;
      position: relative;
      z-index: 99;
    }
  }

  > .tab-text {
    display: flex;
    align-items: center;
    // height: 26px;
    font-size: 20px;
    font-weight: bold;
    color: #00f6ff;
    cursor: pointer;
    background: linear-gradient(0deg, #5bd8f5 0%, #2e83f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
    z-index: 99;
  }
}
</style>
